import { defineStore } from "pinia";
////选项式语法
export const useUserStore = defineStore('user', {
    state: () => {
        return {
            name: '',
            count: 0
        }
    },
    getters: {
        doubleCount(state) {
            return state.count * 2;
        }
    },
    actions: {
        getCount() {
            this.count++;
        }
    }
})
// export { useUserStore }

// //组合式语法
// import { ref, computed } from 'vue';
// export const useUserStore = defineStore('user',()=>{
// const name = ref('');
// const count = ref(0);
// const doubleCount = computed((count) => { return count.value * 2 });
// function getCount() {
//     count.value++;
// }
// return { name, count, doubleCount, getCount }
// })

